/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package isvp.exceptions;

import isvp.constants.ExceptionConstants;

/**
 * Exception generated if there is any problem with individual components in the ISVP
 * @author jjophin
 */
public class ComponentException extends Exception {
    private String message;
    
    public ComponentException(String type, String componentName) {
        if (type.equals(ExceptionConstants.COMP_NO_COMPONENT_EXCEPTION)){
            message = "The " + componentName + " component has not been included in this ISVP";
        } else if (type.equals(ExceptionConstants.COMP_NO_FILE_EXCEPTION)) {
            message = "The file corresponding to " + componentName + " component was not found in the selected ISVP";
        } else if (type.equals(ExceptionConstants.COMP_FILE_READ_EXCEPTION)) {
            message = "Error occurred while reading the xml file corresponding to " + componentName;            
        } else if (type.equals(ExceptionConstants.COMP_INVALID_XML_EXCEPTION)) {
            message = "Invalid XML found in the xml file corresponding to " + componentName;  
        }
    }
    
    @Override
    public String getMessage() {
        return message;
    }
}
